import request from '@/utils/request'
const api_pre = `/admin/acl/permission`;

export default {
    reqMenuData() {
        return request({
            url: api_pre,
            method: "get",
        })
    },

    reqMenuByRole(roleId) {
        return request({
            url: `${api_pre}/toAssign/${roleId}`,
            method: "get",
        })
    },

    setRightsToRole(roleId, permissionId) {
        return request({
            url: `${api_pre}/doAssign`,
            method: "post",
            params: { roleId, permissionId }
        })
    },

    setRightsToRoleList(permissionVo){
        return request({
            url: `${api_pre}/doAssignAcl`,
            method: "post",
            data: permissionVo
        })
    },
    saveMenu(permission) {
        return request({
            url: `${api_pre}/save`,
            method: "post",
            data: permission
        })
    },

    updateMenu(permission) {
        return request({
            url: `${api_pre}/update`,
            method: "put",
            data: permission
        })
    },
    deleteRightById(id) {
        return request({
            url: `${api_pre}/remove/${id}`,
            method: "delete",
        })
    }
}
